package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.DTO.ProductPriceNoticeDTO;
import cn.ywsj.ywsjmidtier.entity.VO.*;
import cn.ywsj.ywsjmidtier.service.WechatViewProductFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "查看商品")
@RestController
@RequestMapping("/wechat/productmgr")
public class WechatViewProductController {

    @Autowired
    private WechatViewProductFeign productFeign;

    /**
     * 商品规格具体参数1
     * 121,1
     * @param productId
     * @param type
     * @return
     */
    @ApiOperation("商品规格具体参数")
    @GetMapping(value = {"/getquerysku"})
    public String getQuerySku(String productId, String type) {
        return productFeign.getQuerySku(productId,type);
    }

    /**
     * 产品详情1
     * @param productQueryVo
     * @return
     */
    @ApiOperation("产品详情")
    @GetMapping("/ajaxproductdetail")
    public String ajaxProductDetail(ProductQueryVo productQueryVo) {
        return productFeign.ajaxProductDetail(productQueryVo.getApplyId(),productQueryVo.getProductId());
    }

    /**
     * 商品列表1
     * @param productQueryVo
     * @param start
     * @param pageSize
     * @return
     */
    @ApiOperation("商品列表")
    @GetMapping("/ajaxproductlist")
    public String list(ProductQueryVo productQueryVo, Integer start, Integer pageSize){
        return productFeign.list(JsonObjectUtil.ObjectToJson(productQueryVo),start,pageSize);
    }


        @GetMapping(value = {"/ajaxproductbannerlist"})
        public String bannerList() {
             return productFeign.bannerList();
        }

        @GetMapping(value = {"/indexproductlist"})
        public String indexProductList(Integer start,Integer pageSize) {
            return productFeign.indexProductList(start,pageSize);
        }

        @GetMapping(value = {"/ajaxopenshopapplydetail"})
        public String ajaxOpenShopApplyDetail(ProductQueryVo productQueryVo) {
            return productFeign.ajaxOpenShopApplyDetail(JsonObjectUtil.ObjectToJson(productQueryVo));
        }

        @GetMapping(value = {"/ajaxproductevaluatelist"})
        private String ajaxProductEvaluateList(String productId ,Integer start, Integer pageSize) {
                return productFeign.ajaxProductEvaluateList(productId,start,pageSize);
        }

        @GetMapping(value = {"/ajaxrecommendproductpages"})
        public String ajaxRecommendProductPages(ProductQueryVo queryVo,Integer start,Integer pageSize) {
            JSONObject jsonObject = JsonObjectUtil.ObjectToJson(queryVo);
        return productFeign.ajaxRecommendProductPages(jsonObject,start,pageSize);
        }

        @PostMapping(value = {"/ajaxusaveproductpricenotice"})
        public String saveProductPriceNotice(ProductPriceNoticeDTO productPriceNoticeDTO) {
            return productFeign.saveProductPriceNotice(JsonObjectUtil.ObjectToJson(productPriceNoticeDTO));
        }

        @GetMapping(value = {"/ajaxproductsetting"})
        public String ajaxProductSetting(ProductSettingQueryVo queryVo) {
             return productFeign.ajaxProductSetting(JsonObjectUtil.ObjectToJson(queryVo));
        }

        @GetMapping(value = {"/ajaxproductsettingmap"})
        public String ajaxProductSettingMap(ProductSettingQueryVo queryVo) {
            return productFeign.ajaxProductSettingMap(JsonObjectUtil.ObjectToJson(queryVo));
        }


        @RequestMapping({"/list"})
        public String maxProduct(Long productId, String type, ProductSkuQueryVo productSkuQueryVo) {
            return productFeign.maxProduct(productId,type,JsonObjectUtil.ObjectToJson(productSkuQueryVo));
        }

        @RequestMapping({"/getopenshop"})
        public String detailProduct(Long custId) {
          return productFeign.detailProduct(custId);
        }

        @RequestMapping({"/getcompanyshopinfo"})
        public String queryCompanyLastestShopInfo(Long custId) {
           return productFeign.queryCompanyLastestShopInfo(custId);
        }

        @RequestMapping({"/ajaxmemberproductlist"})
        public String ajaxMemberProductList(ProductQueryVo productQueryVo) {
             return productFeign.ajaxMemberProductList(JsonObjectUtil.ObjectToJson(productQueryVo));
        }

        @PostMapping({"/ajaxcustcommendproduct"})
        public String ajaxCustCommendProduct(ProductQueryVo productQueryVo) {
           return productFeign.ajaxCustCommendProduct(JsonObjectUtil.ObjectToJson(productQueryVo));
        }

        @RequestMapping({"/getProduct"})
        public String getProduct(ProductVo productVo) {
           return productFeign.getProduct(JsonObjectUtil.ObjectToJson(productVo));
        }



}
